//
//  UIScrollView+Refresh.m
//  Aschat
//
//  Created by  on 2023/3/7.
//  Copyright © 2023 luwei. All rights reserved.
//

#import "UIScrollView+Refresh.h"

@implementation UIScrollView (Refresh)

- (void)addHeaderRefresh:(void (^)(void))block{
    MJRefreshNormalHeader *header = [MJRefreshNormalHeader headerWithRefreshingBlock:block];
    header.lastUpdatedTimeLabel.hidden = YES;
    header.stateLabel.textColor = [UIColor lightGrayColor];
    header.arrowView.hidden = YES;
    self.mj_header = header;
}

- (void)addFooterRefresh:(void (^)(void))block{
    MJRefreshBackNormalFooter *footer = [MJRefreshBackNormalFooter footerWithRefreshingBlock:block];
    footer.height = 60;
    [footer setTitle:@"loading..." forState:MJRefreshStateRefreshing];
    [footer setTitle:@"loading..." forState:MJRefreshStateIdle];
    footer.stateLabel.textColor = [UIColor lightGrayColor];
    self.mj_footer = footer;
}

- (void)beginHeaderRefresh{
    [self.mj_header beginRefreshing];
}

- (void)beginFooterRefresh{
    [self.mj_footer beginRefreshing];
}

- (void)endHeaderRefresh{
    [self.mj_header endRefreshing];
}

- (void)endFooterRefresh{
    [self.mj_footer endRefreshing];
}

@end
